$(document).ready(function () { 
    function activeNav(className) {
        let pathname = window.location.pathname === '/' ? 'index.html' : window.location.pathname
            ;[].slice.call($(".navbar-nav li a")).forEach((item, index) => {
            console.log(pathname);
            if (item.href.includes(pathname)) {
                $(item).removeClass();
				$(item).addClass(className);
            }
		});
    }
    function scrollChangeNav() {
         let el = document.documentElement || document.body;
        let topValue = el.scrollTop || window.pageYOffset;
        let path = window.location.pathname;
            if (topValue > 80 || path.includes('login')) {
                    $(".navbar-brand img").attr('src', '/image/logo1.png');
                    $(".header").css(
                        "box-shadow",
                        "0px 4px 28px 0px rgba(0, 0, 0, 0.3)"
                    );
                    $(".navbar").css("background", "#FFF");
                    $(".navbar-nav a").css("color", "#333");
                    $(".log-in").css("color", "#0156AD");
                    $(".log-in").css("border", "1px solid #0156AD");
                    activeNav("activeB");
            } else {
                $(".navbar-brand img").attr("src", "/image/logo.png");
				$(".header").css("box-shadow", "unset");
				$(".navbar").css("background", "unset");
				$(".navbar-nav a").css("color", "#FFF");
				$(".log-in").css("color", "#FFF");
				$(".log-in").css("border", "1px solid #FFF");
				activeNav("activeW");
			}
    }
    scrollChangeNav()
    window.addEventListener("scroll", scrollChangeNav);
    let isTouch = null
    $(".course-picture-item").mouseenter(function () {
        if (isTouch) {
            clearTimeout(isTouch);
        }
        isTouch = setTimeout(() => {
            [].slice.call($(".course-picture-item")).forEach((item) => {
                if (item === this) {
                    $(this).addClass("active");
                } else {
                    $(item).removeClass("active");
                }
            });
        }, 300);
    })
    let aboutObj = {
		fdu: {
			title: "About FDU",
			intro: `
                <p>
                    Fudan University is one of China's most prestigious and historically significant institutions of higher learning. It is a key national university under the direct administration of the Ministry of Education and is also supported by the Shanghai Municipality. Established in 1905, Fudan University has evolved over more than a century into a first-class institution with a global reputation, committed to its vision of becoming a "comprehensive, innovative, and international" world-class university.
                </p>
                <p>
                    The primary mission of Fudan University is to cultivate talent. Throughout its history, Fudan has nurtured numerous distinguished individuals, including prominent politicians, scientists, social activists, industrial leaders, engineering and technical experts, and medical professionals. Since China's reform and opening up, a new generation of young alumni has emerged, making significant contributions across various sectors worldwide. Fudan University offers a wide range of undergraduate programs across 10 major disciplines: economics, law, literature, science, engineering, medicine, management, arts, education, and information science.
                </p>
                <p>
                    "Learning at Fudan" embodies the university's unique educational philosophy in the modern era. Upholding the mission of preserving cultural heritage, seeking truth, and bearing the responsibility of revitalizing both the Chinese nation and humanity at large, this esteemed institution is on a journey towards achieving its goal of becoming a comprehensive, innovative, and internationalized world-class university. Fudan University belongs to China, but more importantly, it belongs to the world.
                </p>
                `,
		},
		fisf: {
			title: "About FISF",
			intro: `
                <p>
                    International School of Finance, Fudan University (FISF) is a business school founded in accordance with the management model and standards of the world's leading business schools, focusing on high-end financial talent education and financial think-tank research. The School was founded in late 2016 and officially opened in June 2017, with a core faculty team composed of outstanding scholars recruited from around the world.
                </p>
                <p>
                    FISF aspires to ascend to the league of world-class business schools with global and domestic influence in the next 5 to 8 years. To this end, the School is committed to educate future leaders through innovative, best-in-class pedagogy. It is also determined to spearhead cutting-edge research that will further our understanding of the Chinese and international economies and inform decision-making in the public as well as private sectors.
                </p>
                <p>
                    A great school needs great people. That is why FISF is building a core faculty of more than 80 world-renowned scholars as tenured and termed professors, all with proven track records in research and teaching. They will be joined by a team of clinical professors who hold key positions in international organizations, government agencies and successful enterprises to complement classroom learning with their wealth of real-world experience.
                </p>
                <p>
                    With the strong support from key stakeholders and its commitment to academic excellence, FISF strives to become one of the world’s leading business schools for finance, serving business communities in China and beyond.
                </p>
                `,
		},
		us: {
			title: "About Us",
			intro: `
                <p>
                    The concept of International Credit Programs originates from the desire to utilize high-quality teaching resources of universities during summer and winter breaks, enriching students' academic experience. By participating in these programs, students can experience world-class education and immerse themselves in diverse academic environments across different universities.
                </p>
                <p>
                    For Fudan University, running the FDU FISF Global Program is an opportunity to attract professors and students from universities around the globe to our campus, fostering the exchange and integration of diverse ideas. This infusion of fresh perspectives brings vitality and an international vision to our university.
                </p>
                <p>
                    FDU FISF Global Program is designed for both Fudan students and international students. Since its inception, the program has offered students a valuable opportunity to engage with top-tier university education worldwide. Over the years, with continuous development and the accumulation of experience, the International Credit Program at Fudan University has become a significant and influential program in Shanghai.
                </p>
                <p>
                    FDU FISF Global Program at Fudan University operates during both the summer and winter terms. All courses are offered in both in-person and virtual formats, maintaining small class sizes to ensure personalized attention and interaction. Located on the beautiful Handan Campus, our courses span various fields, including Economics, Business, Social Sciences, Humanities, Mathematics, and Natural Sciences. Students have the flexibility to enroll in 1-3 courses per session.
                </p>
                <p>
                    Each summer and winter, Fudan University warmly welcomes professors and students from all over the world to join the International Credit Program, meet new peers, and create wonderful and unique memories at Fudan University.
                </p>
                `,
		},
	};
    $(".about-nav p").on('click', function () {
        ;[].slice.call($(".about-nav p")).forEach(item => {
            if (item === this) {
                $(this).addClass("active");
                let type = this.dataset.type
                let title = aboutObj[type].title
                let intro = aboutObj[type].intro;
                $(".about-title").html(title);
                $(".about-intro").html(intro);
            } else {
                $(item).removeClass("active");
            }
        })
    })
})